import { createRouter, createWebHistory } from 'vue-router';
import HomeView from '../views/HomeView.vue';

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 重定向
    {
      path: '/',
      redirect: '/weather',
    },
    {
      path: '/weather',
      name: 'home',
      component: HomeView,
    },
    {
      path: '/weather/:adcode',
      name: 'search',
      component: () => import('../views/SearchView.vue'),
    },
    {
      path: '/:notfound(.*)*',
      component: () => import('../views/NotFound.vue'),
    },
  ],
});

export default router;
